home *** CD-ROM | disk | FTP | other *** search
-
- /*
- *
- *
- */
-
-
- ; this needs the InstallerNG!
- (if (not @installer-ng-version)
- (abort "This script needs the InstallerNG by Jens Tröger")
- )
-
- ; lets go!
- (user expert)
- (set @proceed-button "Show me more!"
- @abort-button "Shit happens"
- @app-name "properties_example"
- )
-
- ; *******************************************************************
-
- (message "Welcome to a really cool example!\n\n"
- "This will show you the usage of the new functions\n\n"
- "SET-PROPERTY, GET-PROPERTY, REMOVE-PROPERTY,\n"
- "READ-PROPERTY-OBJECT, SAVE-PROPERTY-OBJECT\n\n"
- "which make you able to handle named attribute lists, to\n"
- "read and write such a list, to add, modify and remove\n"
- "attributes from/to such a list\n\n"
- "Enjoy..."
- )
-
- ; read the properties of this object or do nothing, if there are no
- ; properties stored
- (set #savage 0)
- (read-property-object #savage)
-
- ; maybe there was nothing to read! we have to handle that special
- ; case by TRAP'ing the GET-PROPERTY function
- (trap 3 (set #pname (get-property #savage "NAME")))
- (trap 3 (set #pbirth (get-property #savage "BIRTH")))
- (trap 3 (set #psex (get-property #savage "SEX")))
-
- ; modify properties
- (message "First, give me some data!")
-
- ; modify #savage`s properties
- ; NOTE: there are TRAP functions enclosing the GET-PROPERTY functions for
- ; catching the "property not found" error!
- (put-property #savage "NAME" (askstring (prompt "Enter the name")
- (help "")
- (default #pname)
- )
- )
- (put-property #savage "BIRTH" (askstring (prompt ("Enter %s's birthday" (get-property #savage "NAME")))
- (help "")
- (default #pbirth)
- )
- )
-
- (put-property #savage "SEX" (askbool (prompt ("Enter %s's sex" (get-property #savage "NAME")))
- (help "")
- (default #psex)
- (choices "Male" "Female")
- )
- )
-
- ; show the properties
- (message "Now let's see the data...")
- (message "Person's properties are\n\n"
- "Name: " (get-property #savage "NAME") "\n"
- "Birthday: " (get-property #savage "BIRTH") "\n"
- "Sex: " (if (get-property #savage "SEX")
- "Male"
- "Female"
- ) "\n"
- )
-
-
- ; save the objects properties
- (save-property-object #savage)
-
- (exit (quiet))
- (welcome)
-
-
-
-